package eightDataType.mStr;

import java.util.Arrays;
import java.util.HashSet;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * 
 * @author zyj 2018-5-11 16:08:20
 * @fuction string to char(为基本类型)
 *
 * contains CopyOnWriteArrayList 最后是比较的  equals 源码
 */
public class StringDemo2 {

	public static void main(String[] args) {
		splitAdd();
		method22("abc");
		System.out.println("equalsIgnoreCase : "+"1f".equalsIgnoreCase("1F"));

//		String string="123abcABcC";
		CopyOnWriteArrayList<String> mCpList = new CopyOnWriteArrayList<>();
		mCpList.add("a1");
		mCpList.add("a2");
		mCpList.add("a3/sfsfsfssaaaaaaaaaaaaaassd/cdss");

		System.out.println("contains  str "+mCpList.contains("a1"));
		System.out.println("contains  str "+mCpList.contains("a4"));
		System.out.println("contains  str "+mCpList.contains("a3/sfsfsfssaaaaaaaaaaaaaassd/cdss"));


		String string="2019-5-28 14:06:30 123 88";
		System.out.println();


		int lastIndexOf = string.lastIndexOf("c");
		System.err.println(lastIndexOf);
		String substring = string.substring(lastIndexOf+2);
		System.err.println(substring);
//		
//		System.out.println(string.indexOf("3"));
//		System.out.println(string.charAt(3));
//		char[] charArray = string.toCharArray();
//		for (int i = 0; i < charArray.length; i++) {
//			System.out.println(Integer.valueOf(charArray[i]));
//		
//		}
	}

	private static void method22(final String abc) {
//		abc ="bcd";
//		System.out.println(abc);
	}
	//如何将数组转换为Set
	//Arrays.asList()方法(array⇒list⇒set)
	// Collections.addAll()
	// 原文出自[易百教程] 转载请保留原文链接: https://www.yiibai.com/geek/detail/101
	private static void splitAdd(){
		String str = "def_standby_message^欢迎^Welcome^ようこそ^歡迎^Selamat Datang^Selamat datang^hoan nghênh^ยินดีต้อนรับ^Willkommen^Bienvenue^어서 오십시오^benvenuto^Добро пожаловать^أهلا بك^Välkommen^ברוך הבא^bem-vinda^Welkom";
		String[] split = str.split("\\^");//todo 注意： . 、 $、 | 和* 等转义字符，必须得加\
		HashSet<String> set = new HashSet<>();
		set.addAll(Arrays.asList(split));

		System.out.println(set.contains("def_standby_message"));
		System.out.println(set.contains("歡迎"));
		System.out.println(set.contains(""));
		System.out.println(set.contains(null));
	}



}
